<template>
	<view class="container">
		<view class="header">
			<view class="header-title">
				<text>欢迎使用</text>
				<text>税票查询</text>
			</view>
			<view class="header-step">
				<view>
					<text>①</text>
					<text>智能采集</text>
				</view>
				<view>
					<text>②</text>
					<text>智能匹配</text>
				</view>
				<view>
					<text>③</text>
					<text>智能进件</text>
				</view>
			</view>
		</view>
		<view class="main">
			
		<view class="box">
			<view class="box-nav">
				<view class="box-nav-left">
					<text style="color: #FA3C3C;">*</text>
					<text>客户所在区域</text>
				</view>
				<!-- <view class="box-nav-right" @click="goLink">
					税局开通情况>
				</view> -->
			</view>
			<view class="box-city" @click="handleCity">
				
					<view class="box-city-nav">
						<view>{{form.address || '请选择地区'}}</view>
						<image src="@/static/dsj.png" mode="aspectFill" style="width: 16rpx;height: 12rpx;margin-left: 18rpx;"></image>
					</view>
			
			</view>
			<view class="box-form">
				<view class="box-form-item" style="margin-bottom: 16rpx;">
					<image src="@/static/icon7.png" mode="aspectFill" style="width: 28rpx;height: 28rpx;"></image>
					<input placeholder="请输入企业名称" v-model="form.companyName" />
				</view>
				<view class="box-form-item">
					<image src="@/static/icon1.png" mode="aspectFill" style="width: 28rpx;height: 28rpx;"></image>
					<input placeholder="请输入申请人年龄" v-model="form.age" />
				</view>
			</view>
		</view>
		</view>
		<view class="footer">
			<view class="footer-main">
				<view class="footer-main-btn" @click="handleSubmit">
					确认提交授权
				</view>
				<view class="xieyi">
					<xieyi v-model:isCheck="isCheck" style="display: flex;justify-content: center;">
						<text>《税务授权协议》</text>
					</xieyi>
				</view>
			</view>
		</view>
		<cityModal ref="cityModalRef" @checkSuccess="checkSuccess" />
	</view>
</template>

<script setup>
	import {
		reactive,
		ref,
		computed,
		watchEffect,
		onMounted
	} from 'vue'
	import {
		onReady,
		onLoad
	} from '@dcloudio/uni-app'
	import {
		postHttpApi
	} from '@/api/api.js'
	import xieyi from "@/components/xieyi/index.vue"
	import cityModal from "@/components/cityModal/index.vue"
	const isCheck = ref(false)
	const form = ref({})
	const handleSubmit = ()=> {
		if(!isCheck.value){
			uni.showToast({
				title:'请先阅读并勾选用户协议',
				icon:'none'
			})
			return
		}
		postHttpApi({
			companyName: form.value.companyName,
			age: form.value.age,
			address: form.value.address
		},'&type=3&route=Newfinance.authorizationCurl').then(res=>{
			window.location.href = res.data.author_url
		})
	}
	const checkSuccess = (val) => {
		form.value.address = val
	}
	const cityModalRef = ref(null)
	const handleCity = () => {
		cityModalRef.value.open()
	}
	const goLink = ()=> {
		window.open('https://ers.everyoneisceo.com/ksr-sp-wx/credit/status?_tc=59ER26AB&scene=NORMAL')
	}
</script>

<style scoped lang="scss">
	image {
		width: 100%;
		height: 100%;
	}
	.footer{
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background-color: #fff;
		&-main{
			padding: 26rpx;
			&-btn{
				background: #1A64FF;
				border-radius: 10rpx;
				padding: 24rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #FFFFFF;
				text-align: center;
				margin-bottom: 20rpx;
			}
		}
	}
	.main{
		padding: 26rpx;
	}
	.box{
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 36rpx 24rpx 84rpx;
		&-form{
			margin-top: 36rpx;
			&-item{
				display: flex;
				align-items: center;
				background: #F9F9F9;
				border-radius: 10rpx;
				padding: 26rpx 24rpx;
				&>input{
					flex: 1;
					margin-left: 14rpx;
				}
			}
		}
		&-nav{
			display: flex;
			justify-content: space-between;
			align-items: center;
			&-left{
				font-weight: 400;
				font-size: 26rpx;
				color: #000000;
			}
			&-right{
				width: 194rpx;
				height: 52rpx;
				text-align: center;
				line-height: 52rpx;
				background: #EBF2FF;
				border-radius: 200rpx;
				font-weight: 400;
				font-size: 24rpx;
				color: #1A64FF;
			}
		}
		&-city{
			margin-top: 22rpx;
			&-nav{
				display: flex;
				align-items: center;
				font-weight: 400;
				font-size: 32rpx;
				color: #000000;
			}
		}
	}
	.header {
		padding-top: 44rpx;
		&-title {
			font-weight: 400;
			font-size: 48rpx;
			text-align: center;
			&>text:nth-child(1) {
				color: #000000;
			}

			&>text:nth-child(2) {
				color: #1A64FF;
			}
		}

		&-step {
			display: flex;
			justify-content: space-between;
			padding: 52rpx 64rpx;
			&>view {
				font-weight: 400;
				font-size: 24rpx;
				&>text:nth-child(1) {
					color: #1A64FF;
				}

				&>text:nth-child(2) {
					color: #3D3D3D;
				}
			}
		}
	}
</style>